|
|
 |
|
|
|
|
' Create a 3-D transformation matrix for scaling
' by scale factors Sx, Sy, and Sz. Public Sub m3Scale(M() As Single, _
Sx As Single, Sy As Single, Sz As Single)
Dim i As Integer
m3Identity M()
M(1, 1) = Sx
M(2, 2) = Sy
M(3, 3) = Sz
End Sub |
|
|
|
|
|
|
|
|
In two dimensions, reflection across the X or Y axis is simple. To reflect an object across an axis, you scale it using a negative scale factor. For instance, to reflect an object across the Y axis, you scale it by a factor of 1 in the X direction using a transformation matrix like this one: |
|
|
|
|
|
|
|
|
When you apply this matrix to the point (x, y), you get: |
|
|
|
|
|
|
|
|
In three dimensions, you must reflect an object across a plane instead of a line. Reflecting an object across the XY, XZ, or YZ planes is easy. Simply scale the point using 1 as one of the scale factors. For example, to reflect an object across the XY plane, use a scaling transformation matrix where Sx = 1, Sy = 1, and Sz = 1. To perform one of these simple reflections, use the appropriate transformation matrix shown in Table 13.1. |
|
|
|
|
|
|
|
|
Because these reflection matrices are the same as simple scaling matrices, you do not need to write separate Visual Basic routines to initialize reflection transformations. |
|
|
|
|
| Table 13.1 Reflection Transformation Matrices | ACROSS THE
X-Y PLANE | ACROSS THE
X-Z PLANE | ACROSS THE
Y-Z PLANE | | | |
|
|
|